home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / lib.fmt / m / lgamma.man < prev    next >
Encoding:
Text File  |  1990-02-27  |  3.0 KB  |  133 lines

  1.  
  2.  
  3.  
  4. LGAMMA           Mathematical Library Procedures           LGAMMA
  5.  
  6.  
  7.  
  8. NNAAMMEE
  9.      lgamma - log gamma function
  10.  
  11. SSYYNNOOPPSSIISS
  12.      ##iinncclluuddee <<mmaatthh..hh>>
  13.  
  14.      ddoouubbllee llggaammmmaa((xx))
  15.      ddoouubbllee xx;;
  16.  
  17. DDEESSCCRRIIPPTTIIOONN
  18.      Lgamma returns ln|I~(x)|.
  19.  
  20.      The external integer signgam returns the sign of I~(x) .
  21.  
  22. IIDDIIOOSSYYNNCCRRAASSIIEESS
  23.      Do nnoott use the expression signgam*exp(lgamma(x)) to compute
  24.      g := I~(x).  Instead use a program like this (in C):
  25.           lg = lgamma(x); g = signgam*exp(lg);
  26.  
  27.      Only after lgamma has returned can signgam be correct.  Note
  28.      too that I~(x) must overflow when x is large enough, under-
  29.      flow when -x is large enough, and spawn a division by zero
  30.      when x is a nonpositive integer.
  31.  
  32.      Only in the UNIX math library for C was the name gamma ever
  33.      attached to lnI~.  Elsewhere, for instance in IBM's FORTRAN
  34.      library, the name GAMMA belongs to I~ and the name ALGAMA to
  35.      lnI~ in single precision; in double the names are DGAMMA and
  36.      DLGAMA.  Why should C be different?
  37.  
  38.      Archaeological records suggest that C's gamma originally
  39.      delivered ln(I~(|x|)).  Later, the program gamma was changed
  40.      to cope with negative arguments x in a more conventional
  41.      way, but the documentation did not reflect that change
  42.      correctly.  The most recent change corrects inaccurate
  43.      values when x is almost a negative integer, and lets I~(x) be
  44.      computed without conditional expressions.  Programmers
  45.      should not assume that lgamma has settled down.
  46.  
  47.      At some time in the future, the name _g_a_m_m_a will be rehabili-
  48.      tated and used for the gamma function, just as is done in
  49.      FORTRAN.  The reason for this is not so much compatibility
  50.      with FORTRAN as a desire to achieve greater speed for
  51.      smaller values of |x| and greater accuracy for larger
  52.      values.
  53.  
  54.      Meanwhile, programmers who have to use the name _g_a_m_m_a in its
  55.      former sense, for what is now _l_g_a_m_m_a, have two choices:
  56.  
  57.      1) Use the old math library, _l_i_b_o_m.
  58.  
  59.      2) Add the following program to your others:
  60.  
  61.  
  62.  
  63. Sprite v1.0               May 12, 1986                          1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. LGAMMA           Mathematical Library Procedures           LGAMMA
  71.  
  72.  
  73.  
  74.         ##iinncclluuddee <<mmaatthh..hh>>
  75.         ddoouubbllee ggaammmmaa((xx))
  76.         ddoouubbllee xx;;
  77.         {{
  78.              rreettuurrnn ((llggaammmmaa((xx))));;
  79.         }
  80.  
  81. DDIIAAGGNNOOSSTTIICCSS
  82.      The reserved operand is returned on a VAX for negative
  83.      integer arguments, _e_r_r_n_o is set to ERANGE; for very large
  84.      arguments over/underflows will occur inside the _l_g_a_m_m_a rou-
  85.      tine.
  86.  
  87. SSEEEE AALLSSOO
  88.      math(3M), infnan(3M)
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129. Sprite v1.0               May 12, 1986                          2
  130.  
  131.  
  132.  
  133.